﻿using System;
using System.Collections.Generic;
using System.Text;
using VisionCloud.Domain.DtoModel.Schedule.WorkOrder;

namespace VisionCloud.Domain.Configs
{
    public class WorkOrderCodeAndNameMap
    {
        /// <summary>
        /// 根据工序编号取工序名称
        /// </summary>
        /// <param name="procedureCode"></param>
        /// <returns></returns>
        public static string GetNameWithCode(string procedureCode)
        {
            return procedureCode switch
            {
                "GX-07-51" => "机器人测量（初装修）",
                "GX-07-51-01" => "天花打磨测量-机器人",
                "GX-07-51-02" => "内墙打磨测量-机器人",
                "GX-07-51-03" => "螺杆洞封堵测量-机器人",
                "GX-07-51-04" => "传统抹灰测量-机器人",
                "GX-07-51-05" => "砂浆喷涂测量-机器人",
                "GX-09-60" => "机器人测量（精装修）",
                "GX-09-60-01" => "腻子打磨测量-机器人",
                "GX-09-60-02" => "墙/铺贴测量-机器人",
                "GX-09-60-03" => "阳台地砖铺贴测量-机器人",
                _ => "机器人测量（初装修）",
            };
        }

        /// <summary>
        /// 根据工序号来判断工单任务类型
        /// </summary>
        /// <param name="procedureCode"></param>
        /// <returns></returns>
        public static WorkOrderTaskTypeEnum GetTaskType(string procedureCode) => procedureCode switch
        {
            "GX-07-51" => WorkOrderTaskTypeEnum.机器人测量初装修,
            "GX-07-51-01" => WorkOrderTaskTypeEnum.天花,
            "GX-07-51-02" => WorkOrderTaskTypeEnum.内墙,
            "GX-07-51-03" => WorkOrderTaskTypeEnum.螺杆洞,
            "GX-07-51-04" => WorkOrderTaskTypeEnum.传统抹灰,
            "GX-07-51-05" => WorkOrderTaskTypeEnum.砂浆喷涂,
            "GX-07-60" => WorkOrderTaskTypeEnum.机器人测量精装修,
            "GX-07-60-01" => WorkOrderTaskTypeEnum.腻子打磨,
            "GX-09-60-02" => WorkOrderTaskTypeEnum.墙砖铺贴,
            "GX-09-60-03" => WorkOrderTaskTypeEnum.阳台地砖铺贴,
            _ => WorkOrderTaskTypeEnum.未知
        };

        /// <summary>
        /// 根据机器类型枚举获取机器代码
        /// </summary>
        /// <param name="robot"></param>
        /// <returns></returns>
        public static string GetProcedureCode(WorkOrderTaskTypeEnum robot) => robot switch
        {
            WorkOrderTaskTypeEnum.机器人测量初装修 => "GX-07-51",
            WorkOrderTaskTypeEnum.天花 => "GX-07-51-01",
            WorkOrderTaskTypeEnum.内墙 => "GX-07-51-02",
            WorkOrderTaskTypeEnum.螺杆洞 => "GX-07-51-03",
            WorkOrderTaskTypeEnum.传统抹灰 => "GX-07-51-04",
            WorkOrderTaskTypeEnum.砂浆喷涂 => "GX-07-51-05",
            WorkOrderTaskTypeEnum.机器人测量精装修 => "GX-07-60",
            WorkOrderTaskTypeEnum.腻子打磨 => "GX-07-60-01",
            WorkOrderTaskTypeEnum.墙砖铺贴 => "GX-09-60-02",
            WorkOrderTaskTypeEnum.阳台地砖铺贴 => "GX-09-60-03",
            WorkOrderTaskTypeEnum.未知 => string.Empty,
            _ => string.Empty
        };
    }
}
